-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #6432: Bail out from beacon conditions #6555
Closes #6432: Bail out from beacon conditions #6555
Conversation
dcd698f
to
4e3757f
Compare
4e3757f
to
592a01e
Compare
592a01e
to
1308890
Compare
Is this ready for review? |
@Tabrisrp, yes it is ready. |
You have some conflicts to fix in the JS |
…nt/6432-bail-out-from-beacon-conditions
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more |
…nt/6432-bail-out-from-beacon-conditions
@Miraeld There are conflicts to be resolved. Then it should be merged ASAP to avoid further conflicts with upcoming changes on the beacon. |
…nt/6432-bail-out-from-beacon-conditions
3f46bf6
into
feature/lcp-above-the-fold-optimization
@Mai-Saad, there is no test plan available for this yet, Please find screenshots of the result as follow: DesktopCase 1Opening a page in desktop mode while not meeting the size resolution requirements, we bail out. Case 2Opening a page in desktop while meeting the size resolution, we process and get results. Case 3Opening a page in desktop while we already have saved data within the database. MobileCase 1Opening a page in mobile mode while not meeting the size resolution requirements, we bail out. Case 2Opening a page in mobile while meeting the size resolution, we process and get results. Case 3Opening a page in mobile while we already have saved data within the database. Please review this results for now and if everything's okay, we can move it to QA Done. |
@Miraeld Maybe we need to test the new filters and also that they are guarded against bad values? (null, [], string, etc.). If wrong value, then the default value should be applied. |
True that, Here is the following tests: Changing values of the filterSettings new threshold:// Change the width threshold for the LCP beacon.
add_filter( 'rocket_lcp_width_threshold', function( $width_threshold, $is_mobile, $url ) {
return $is_mobile ? 500 : 2500;
}, 10, 3 );
// Change the height threshold for the LCP beacon.
add_filter( 'rocket_lcp_height_threshold', function( $height_threshold, $is_mobile, $url ) {
return $is_mobile ? 900 : 1200;
}, 10, 3 ); Thresholds are working perfectly. Passing
|
Ok on my side 👍 |
Description
Fixes #6432
This PR modifies the beacon script to add a check for existing image data related to the URL in the database. If such data exists or the status is failed, the script process should be stopped. Additionally, a screen-size check should be added to the script to bail out under certain conditions.
Documentation
User documentation
This change does not directly impact users as it is related to the test setup and the beacon script.
Technical documentation
The
add_lcp_data
andcheck_lcp_data
methods in theController.php
file are used to add and check LCP data respectively. Themain
function in thelcp-beacon.js
file has been modified to make an AJAX call to check if there are any records for the current URL and to check the screen size. If the screen size is not within the acceptable range, the function bails out.Type of change
New dependencies
N/A
Risks
N/A
Checklists
Feature validation
Documentation
Code style
Acceptance Criteria Reminder
Bail-out if data is already available:
Bail-out if not acceptable screen-size: (Use BrowserStack or Rocket-E2E)
Check the screen-size filters: